<?php


require_once $_SERVER['DOCUMENT_ROOT'] . '/config.php';
use JsonDb\JsonDb\Db;

$data = Db::name('config')->where('id', 1)->find();
$oss = $data['cdn'];
$svg = Db::name('svg')->select();
$zd = Db::name('zd')->select();
$lc = Db::name('lc')->select();
?>
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <?php if ($data['title'] == null): ?>
        <title><?php echo $data['name']; ?></title>
    <?php else: ?>
        <title><?php echo $data['name'] . "-" . $data['title']; ?></title>
    <?php endif; ?>

    <meta name="keywords" content="<?php echo $data['keywords']; ?>">
    <meta name="description" content="<?php echo $data['description']; ?>">
    <link rel="shortcut icon" href="<?php echo $data['ico']; ?>">
    <meta
      charset="utf-8"
      name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
    />
    <link rel="stylesheet" href="<?php echo $oss; ?>/assets/style.css" />
  </head>

  <body>
    <nav>
      <a href="#" id="home" class="active">首页</a>
      <a href="#" id="about">关于</a>
      <a href="#" id="timeline">历程</a>
      <a href="#" id="website">站点</a>
      <img src="<?php echo $oss; ?>/assets/images/icon/play.svg" id="music" alt="music" />
      <img src="<?php echo $oss; ?>/assets/images/icon/sun.svg" id="darkMode" alt="darkMode" />
    </nav>

    <main class="scrollbar">
      <section title="home">
        <img src="<?php echo $data['bj']; ?>" id="bg" alt="背景" />
        <img
          src="<?php echo $data['logo']; ?>"
          class="avatar"
          onclick="alert('戳我干嘛 ￣へ￣')"
        />
        <div class="info">
          <h2><?php echo $data['title1']; ?></h2>
          <h4><?php echo $data['title2']; ?></h4>
        </div>
        <div id="link"></div>
      </section>
      <section title="about">
        <div class="item">
        <?php echo $data['infor']; ?>
        </div>
        <div id="project" class="item">
        <?php echo $data['inforxf']; ?>
        </div>
      </section>
      <section title="timeline">
        <div class="item">
          <ul id="line"></ul>
        </div>
      </section>
      <section title="website">
        <ul id="site"></ul>
      </section>
    </main>
    <footer>
    <?php echo $data['copyright']; ?>
    </footer>
    <div id="tp-weather-widget"></div>
    <img
      src="<?php echo $oss; ?>/assets/images/China.svg"
      alt="China"
      style="width: 70px; position: fixed; right: 10px; bottom: 40px"
    />
    <audio preload="load" id="music" loop="loop">
      <!-- 未来音乐链接可能会失效，可自行更换 -->
      <source src="<?php echo $data['music']; ?>" />
    </audio>
    <script src="<?php echo $oss; ?>/assets/index.js"></script>
  </body>
</html>
